/* afaik popover needs a positioning context to be able to calculate the transform */
.PopoverContainer {
  position: absolute;
  z-index: 4;
}

.PopoverBody {
  pointer-events: auto;
  min-width: 1em; /* ewwwwwwww */
  display: flex;
  flex-direction: column;
  /* add a max-width so that long strings don't cause the popover to expand
   * see metabase#4930 */
  max-width: 500px;
}

.PopoverBody.PopoverBody--withBackground {
  border: 1px solid #edf2f5;
  box-shadow: 0 4px 10px var(--color-shadow);
  background-color: var(--color-bg-white);
  border-radius: 6px;
  overflow: auto;
}

/* remove the max-width in cases where the popover content needs to expand
 * initially added  for date pickers so the dual date picker can fully
 * expand as necessary - metabase#5971
 */
.PopoverBody.PopoverBody--autoWidth {
  max-width: none;
}

.PopoverBody.PopoverBody--tooltip {
  color: white;
  font-weight: bold;
  background-color: var(--color-bg-black);
  border: none;
  pointer-events: none;
  line-height: 1.26;
  padding: 10px 12px;
}
.PopoverBody.PopoverBody--tooltip.PopoverBody--tooltipConstrainedWidth {
  font-size: 12px;
  max-width: 200px;
}

/* shared arrow styles */
.PopoverBody--withArrow:before,
.PopoverBody--withArrow:after {
  position: absolute;
  content: "";
  display: block;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  pointer-events: none;
}

.PopoverBody .Form-input {
  font-size: 1rem;
}

.PopoverBody .Form-field {
  margin-bottom: 0.75rem;
}

.PopoverHeader {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  min-width: 400px;
}

.PopoverHeader-item {
  flex: 1;
  position: relative;
  top: 1px; /* to overlap bottom border */
  text-align: center;
  padding: 1em;

  text-transform: uppercase;
  font-size: 0.8em;
  font-weight: 700;
  color: var(--color-text-medium);
  border-bottom: 2px solid transparent;
}

.PopoverHeader-item.selected {
  color: currentcolor;
  border-color: currentcolor;
}

.PopoverHeader-item--withArrow {
  margin-right: 8px;
}

.PopoverHeader-item--withArrow:before,
.PopoverHeader-item--withArrow:after {
  position: absolute;
  content: "";
  display: block;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  top: 50%;
  margin-top: -8px;
}

/* create a slightly larger arrow on the right for border purposes */
.PopoverHeader-item--withArrow:before {
  right: -16px;
  border-left-color: var(--color-border);
}

/* create a smaller inset arrow on the right */
.PopoverHeader-item--withArrow:after {
  right: -15px;
  border-left-color: var(--color-bg-white);
}

/* create a slightly larger arrow on the top for border purposes */
.tether-element-attached-top .PopoverBody--withArrow:before {
  top: -20px;
  border-bottom-color: var(--color-border);
}
.tether-element-attached-top .PopoverBody--tooltip:before {
  border-bottom: none;
}

/* create a smaller inset arrow on the top */
.tether-element-attached-top .PopoverBody--withArrow:after {
  top: -18px;
  border-bottom-color: var(--color-bg-white);
}
.tether-element-attached-top .PopoverBody--tooltip:after {
  border-bottom-color: var(--color-bg-black);
}

/* create a slightly larger arrow on the bottom for border purposes */
.tether-element-attached-bottom .PopoverBody--withArrow:before {
  bottom: -20px;
  border-top-color: var(--color-border);
}
.tether-element-attached-bottom .PopoverBody--tooltip:before {
  border-top: none;
}

/* create a smaller inset arrow on the bottom */
.tether-element-attached-bottom .PopoverBody--withArrow:after {
  bottom: -18px;
  border-top-color: var(--color-bg-white);
}
.tether-element-attached-bottom .PopoverBody--tooltip:after {
  border-top-color: var(--color-bg-black);
}

/* if the tether element is attached right, move our arrows right */
.tether-target-attached-right .PopoverBody--withArrow:before,
.tether-target-attached-right .PopoverBody--withArrow:after {
  right: 12px;
}

/* if the tether element is attached center, move our arrows to the center */
.tether-element-attached-center .PopoverBody--withArrow:before,
.tether-element-attached-center .PopoverBody--withArrow:after {
  margin-left: 50%;
  left: -10px;
}

.tether-element-attached-right .PopoverBody--withArrow:before,
.tether-element-attached-right .PopoverBody--withArrow:after {
  right: 12px;
}

.tether-element-attached-left .PopoverBody--withArrow:before,
.tether-element-attached-left .PopoverBody--withArrow:after {
  left: 12px;
}

#popover-event-target {
  position: fixed;
  width: 6px;
  height: 6px;
  pointer-events: none;
}

/* transition classes */

.Popover-appear,
.Popover-enter {
  opacity: 0.01;
}

.Popover-appear.Popover-appear-active,
.Popover-enter.Popover-enter-active {
  opacity: 1;
  transition: opacity 100ms ease-in;
}

.Popover-leave {
  opacity: 1;
}

.Popover-leave.Popover-leave-active {
  opacity: 0.01;
  transition: opacity 100ms ease-in;
}
